﻿Imports System.Windows.Controls
Partial Public Class AddressControl
    Public Event Bang(ByVal textBlockName As String)
    Public Property CountryComboBox() As ComboBox
        Get
            Return drpCountry
        End Get
        Set(ByVal value As ComboBox)

            drpCountry = value

        End Set
    End Property

    Public Property CountyComboBox() As ComboBox
        Get
            Return Me.drpCounty
        End Get
        Set(ByVal value As ComboBox)

            Me.drpCounty = value

        End Set
    End Property
    Public Property AddressText() As TextBox
        Get
            Return Me.txtAddress

        End Get
        Set(ByVal value As TextBox)

            Me.txtAddress = value

        End Set
    End Property
    Public Property RegionText() As TextBox
        Get
            Return Me.txtRegion

        End Get
        Set(ByVal value As TextBox)

            Me.txtRegion = value

        End Set
    End Property
    Public Property PostcodeText() As TextBox
        Get
            Return Me.txtPostcode

        End Get
        Set(ByVal value As TextBox)

            Me.txtPostcode = value

        End Set
    End Property
    Public Property Description() As ComboBox
        Get
            Return Me.cboDescription

        End Get
        Set(ByVal value As ComboBox)

            Me.cboDescription = value

        End Set
    End Property
    Private Sub drpCountry_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles drpCountry.KeyUp
        FireEvent("Country")
    End Sub
    Private Sub drpCounty_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs)
        FireEvent("County")
    End Sub
    Private Sub drpCountry_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles drpCountry.SelectionChanged
        If Me.drpCountry.SelectedValue = 71 Then 'GlobalCRM.COUNTRY_UK Then
            Me.drpCounty.Visibility = Windows.Visibility.Visible
            Me.txtRegion.Visibility = Windows.Visibility.Hidden
            Me.lblArea.Content = "County"
        Else
            Me.drpCounty.Visibility = Windows.Visibility.Hidden
            Me.drpCounty.SelectedIndex = -1
            Me.txtRegion.Visibility = Windows.Visibility.Visible
            Me.lblArea.Content = "Region"
        End If
    End Sub

    Private Sub cboDescription_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles cboDescription.KeyUp
        FireEvent("Description")
    End Sub

    Public Sub FireEvent(ByVal textBlockName As String)
        RaiseEvent Bang(textBlockName)
    End Sub

    Private Sub txtAddress_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles txtAddress.KeyUp
        FireEvent("Address")
    End Sub

    Private Sub txtPostcode_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles txtPostcode.KeyUp
        FireEvent("Postcode")
    End Sub

    Private Sub txtRegion_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles txtRegion.KeyUp
        FireEvent("Region")
    End Sub
End Class
